#include <Qtgui>
#include "Window.h"
#include "HGEWindow.h"
#include "common.h"
#include "HGEHandle.h"
#include "hgeSprite.h"

Window::Window()
: QWidget()
{
    resize(QSize(600, 300));
	setAttribute(Qt::WA_PaintOnScreen, true);

	QPushButton *upButton = new QPushButton(tr("Up"));
	QPushButton *downButton = new QPushButton(tr("Down"));
	HGEWindow* HgeWin = new HGEWindow(this);
	HgeWin->init();

	QGridLayout *layout = new QGridLayout;
	layout->addWidget(upButton);
	layout->addWidget(HgeWin);
	layout->addWidget(downButton);
	setLayout(layout);

	QTimer *timer = new QTimer(this);
	connect(timer, SIGNAL(timeout()), HgeWin, SLOT(update()));
	timer->start(10);

	connect(upButton, SIGNAL(clicked()), HgeWin, SLOT(move_up()));
	connect(downButton, SIGNAL(clicked()), HgeWin, SLOT(move_down()));
}